package com.zyh.fengzhuanghejichengzuoye.test1.domian;

import java.util.Scanner;

public class ITPerson {
    private String name;
    private int age;
    private String subject;
    private int jobYear;
    private String address;
    private String job;

    //构造方法
    public ITPerson() {
    }

    public ITPerson(String name, int age, String subject, int jobYear, String address, String job) {
        this.name = name;
        this.age = age;
        this.subject = subject;
        this.jobYear = jobYear;
        this.address = address;
        this.job = job;
    }

    //行为
    public void work(){
        System.out.println("姓名："+getName());
        System.out.println("年龄："+getAge());
        System.out.println("技术方向："+getSubject());
        System.out.println("工作年限："+getJobYear());
        System.out.println("目前就职于："+getAddress());
        System.out.println("职务是："+getJob());
    }

    // getter and setter

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age<15){
            System.out.println("年龄信息无效！已修改默认年龄为15");
            this.age=15;
        }
        else {
            this.age = age;
        }
    }
    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public int getJobYear() {
        return jobYear;
    }

    public void setJobYear(int jobYear) {
        this.jobYear = jobYear;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }
}
